package com.yanqu.road.server.cmd.banquet.goodbanquet;

import com.yanqu.road.pb.banquet.CrossBanquetProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.banquet.baifubanquet.CrossGoodBanquetMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Protocol;

/**
 * @Description
 * @Author cwq
 * @Data 2021/11/9 17:09
 */
@Cmd(code = Protocol.C2_GOOD_BANQUET_LIST, desc = "请求百福宴列表")
public class CrossGoodBanquetGetListCmd extends CrossCommand {

    long userId;
    int activityId;
    int type;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        CrossBanquetProto.GoodBanquetListReqMsg reqMsg = CrossBanquetProto.GoodBanquetListReqMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        activityId = reqMsg.getActivityId();
        type = reqMsg.getType();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId, YanQuMessageUtils.buildMessage(ClientProtocol.U_CROSS_GOOD_BANQUET_LIST, CrossGoodBanquetMgr.getOpenGoodBanquetList(activityId,userId,type)));
    }

    @Override
    public void sendData() {

    }
}
